package br.com.nutriplus.util;

import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;

public class Log {

	public static void f(IOException e) {
		log("[FATAL] - " + stackTrace(e));
		System.exit(1);
	}

	private static void log(String message) {
		System.out.println(message);
	}

	private static String stackTrace(Exception e) {
		try {
			StringWriter sw = new StringWriter();
			PrintWriter pw = new PrintWriter(sw);
			e.printStackTrace(pw);
			return sw.toString();
		} catch (Exception e2) {
			e2.printStackTrace();
			return "Could not get the stacktrace";
		}
	}

	public static void i(String message) {
		log("[INFO] - " + message);
		
	}

	public static void d(String message) {
		log("[DEBUG] - " + message);
	}

}
